import Request from "../uilts/Request"
//登陆接口
export const login = (data) => Request({
    url: `/api/user/login.do?username=${data.username}&password=${data.password}`,
    method: "post",
    data
})
// 统计接口
export const statistic = (url) => Request({
    url: `/api/manage/statistic/base_count.do`,
    method: "post",
})
// 用户管理
export const userlist = (data) => Request({
    url: `/api/manage/user/list.do?pageSize=${data.pagesize}&pageNum=${data.pagenum}`,
    method: "post",
    data
})
// 商品列表
export const goodlist = (data) => Request({
    url: `/api/manage/product/list.do?pageSize=${data.pagesize}&pageNum=${data.pagenum}`,
    method: "post",
    data
})
// 产品上下架
export const gai = (url) => Request({
    url,
    method: "put",
})
// 商品搜索
// 按商品名查询
export const search = (data) => Request({
    url: `/api/manage/product/search.do?productName=${data}`,
    method: "get",
    data
})
// 按id名查询
export const searchid = (data) => Request({
    url: `/api/manage/product/search.do?productId=${data}`,
    method: "get",
    data
})
// 商品详情
export const details = (data) => Request({
    url: `/api/manage/product/detail.do?productId=${data}`,
    method: "get",
    data
})
// 二级类获取
export const classification = (data = 0) => Request({
    url: `/api/manage/category/get_category.do?categoryId=${data}`,
    method: "get",
    data
})
// 修改产品
export const edit = (data) => Request({
    url: `/api/manage/product/save.do?categoryId=${data.id}&name=${data.name}&subtitle=${data.subtitle}&subImages=test.jpg&detail=detailtext&price=${data.price}&stock=${data.stock}&status=1&id=${data.id}
    `,
    method: "post",
    data
})
// 添加产品
export const add = (data) => Request({
    url: `/api/manage/product/save.do?categoryId=${10001}&name=${data.name}&subtitle=${data.subtitle}&subImages=${data.subImages}&detail=${data.detail}&price=${data.price}&stock=${data.stock}&status=1
    `,
    method: "post",
    data
})
// 修改名称
export const editname = (data) => Request({
    url: `/api/manage/category/set_category_name.do?categoryId=${data.categoryId}&categoryName=${data.categoryName}`,
    method: "post",
    data
})
//  添加品类名称
export const addname = (data) => Request({
    url: `/api/manage/category/add_category.do?parentId=${0}&categoryName=${data}`,
    method: "post",
    data
})
//  订单管理
export const orderlist = (data) => Request({
    url: `/api/manage/order/list.do?pageSize=${data.pagesize}&pageNum=${data.pagenum}`,
    method: "post",
    data
})
//  查询订单
export const searchorder = (data) => Request({
    url: `/api/manage/order/search.do?orderNo=${data}`,
    method: "post",
    data
})

